#include<iostream>
using namespace std;

int main(){
	int n,sum = 0;
	cin>>n;
	for(int j = 1;j<=n;j++){
		int i = j;
		while(i!=0){
			sum += i%10;
			i/=10;
		}
	}
	cout<<sum;
	return 0;
}

